from __future__ import print_function
from clickhouse_driver import connect
host='127.0.0.1' #服务器地址
port=9000 #端口
user='default' #用户名
password='' #密码
send_receive_timeout = 300  #超时时间
# client = Client(host=host, port=port, user=user, password=password, send_receive_timeout=send_receive_timeout)
conn = connect(host=host, port=port, user=user, password=password, database='github_log')
cursor = conn.cursor()

if __name__ == "__main__":
    # 10000
    sql = "select body from github_log.events where type = 'PullRequestReviewCommentEvent' and toYear(created_at) = 2021"
    cursor.execute(sql)
    allRepoCount = cursor.fetchall()
    allRepoList = []
    for obj in allRepoCount:
        print(obj[0])
    print(sorted(allRepoList))
    cursor.close()
    conn.close()





